package demo.database;

import java.sql.Connection;
import java.sql.DriverManager;

import com.titan.core.utils.db.DBUtils;

/**
 *
 *
 * @author 周成功
 *
 */
public class TestIndex {
//    public static void main(String[] args) {
//        Connection conn = null;
//        try {
//            //String sql = "SELECT count(*) FROM mlos_tf_accountjournal";
//            String sql = "SELECT * FROM mlos_tf_accountjournal WHERE 1 = 1   AND (balanceflag = ?)   AND (posttype = ?)   AND (collectflag != ?)   AND orilineid = 'ORF00000000000000005581'   AND systemid = 'TASP001' ORDER BY serialno";
//            
//            conn = DBUtils.getConnection("192.170.0.193", "1521", "etms", "etms3_asp", "etms3_asp", true);
//            long time = System.currentTimeMillis();
//            
//            RecordSet rest = DBUtils.executeQueryToRecordSet(conn, sql, new String[]{"1", "1", "2"});
//            //System.out.println(DBUtils.getValue(conn, sql));
//            System.out.println(rest.getRowCount());
//            time = System.currentTimeMillis()-time;
//            System.out.println("user time : "+time+"ms");
//        } catch (Exception e) {
//            e.printStackTrace();
//        } finally {
//            DBUtils.close(conn);
//        }
//    }

      public static void main(String[] args) {
      Connection conn = null;
      try {
          String sql = "SELECT count(*) FROM mlos_tf_accountjournal";
          //String sql = "SELECT * FROM mlos_tf_accountjournal WHERE 1 = 1   AND (balanceflag = ?)   AND (posttype = ?)   AND (collectflag != ?)   AND orilineid = 'ORF00000000000000005581'   AND systemid = 'TASP001' ORDER BY serialno";
          
          String sDBDriver = "weblogic.jdbcx.oracle.OracleDataSource";
          String sConnStr = "jdbc:bea:oracle:@192.170.0.193:1521:etms";
          Class.forName(sDBDriver);
          conn = DriverManager.getConnection(sConnStr, "etms3_asp", "etms3_asp");
          long time = System.currentTimeMillis();
          
          //RecordSet rest = DBUtils.executeQueryToRecordSet(conn, sql, new String[]{"1", "1", "2"});
          System.out.println(DBUtils.getValue(conn, sql));
          //System.out.println(rest.getRowCount());
          time = System.currentTimeMillis()-time;
          System.out.println("user time : "+time+"ms");
      } catch (Exception e) {
          e.printStackTrace();
      } finally {
          DBUtils.close(conn);
      }
    }

}

